/*
 * @(#)ResultProcess.java
 * 
 * Project: CUPSecureBM
 * 
 * Modify Information:
 * =============================================================================
 * Author           Date              Description 
 * hitrust          2005-12-7         first release
 * 
 * Copyright Notice:
 * =============================================================================
 * Copyright (c) 2001-2005 Beijing HiTRUST Technology Co., Ltd. 1808 Room,
 * Science & Technology Building, No. 9 South Street, Zhong Guan Cun, Haidian
 * District, Beijing ,100081, China All rights reserved.
 * 
 * This software is the confidential and proprietary information of Beijing
 * HiTRUST Technology Co., Ltd. ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in accordance
 * with the terms of the license agreement you entered into with HiTRUST.
 * 
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.util.page;

import java.util.ArrayList;
/**
 * 查询结果集分页处理封装
 */
public class ResultProcess {
    private ArrayList iList;
    private int       iColumnCount;
    
    public void setResult(ArrayList aList) {
        this.iList = aList;
        this.iColumnCount = this.iList.size();
    }
    /**
     * 取得指定范围的记录集
     * @param index     ：开始索引
     * @param num       ：笔数
     * @return
     */
    public ArrayList getDisplayRecords(int index, int num) {
        ArrayList tRec = new ArrayList();
        int j = 0;
        if (index > 0)
            index--;
        int iTotal = index + num;
        if (iTotal > iColumnCount)
            iTotal = iColumnCount;
        for (int i = index; i < iTotal; i++) {
            tRec.add(j, this.iList.get(i));
            j++;
        }
        return tRec;
    }
    /**
     * 返回全部记录
     * @return
     */
    public ArrayList getAllRecoreds(){
        return this.iList;
    }
    /**
     * 取得记录大小
     * @return
     */
    public int getRecordsSize(){
        return this.iColumnCount;
    }
}
